from http import HTTPStatus
from flask import Flask, request, make_response, jsonify
from tictactoe_server import TictactoeServer


app = Flask(__name__)

# game_room = {}
tictactoe_server = TictactoeServer()


@app.route("/")
def hello_word():
    return "hello_word"


@app.route("/play/tictactoe", methods=["POST"])
def play_tictactoe():

    return "hello_world"


@app.route("/play/tictactoe/start", methods=["GET", "POST"])
def start_tictactoe():
    tictactoe_server.init()
    response = {
        "message": "Game start!",
        "checkerboard": tictactoe_server.checkerboard
    }
    return make_response(jsonify(response), HTTPStatus.OK)


if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0', port=8000)
